$(function(){
	
	//跳转到添加管理员界面
	$("#toAddSysUser").click(function(){
		window.location.href="addSysUser.html";
	})
	//添加管理员
	$("#addSysUser").click(function(){
		var loginName=$("#loginName").val();
		var pwd=$("#pwd").val();
		var pwd1=$("#pwd1").val();
		var realName=$("#realName").val();
		var deleteFlag=$("#deleteFlag").val();
		var roleId=$("#roles").val();
		var mobile=$("#mobile").val();
		var job=$("#job").val();
		$.ajax({
			url:'addSysUser',
			type:'post',
			dataType:'json',
			data:{loginName:loginName,pwd:pwd,pwd1:pwd1,realName:realName,
				deleteFlag:deleteFlag,roleId:roleId,mobile:mobile,job:job},
			success:function(data){
				alert(data.msg);
				if(data.status==0){
					window.location.href="sysUser.html";
				}
			},
			error:function(data){
				alert(errMsg);
			}
		})
	})
	//修改管理员
	$("#modifySysUser").click(function(){
		
		var userId=$("#userId").val();
		var loginName=$("#loginName").val();
		var pwd=$("#pwd").val();
		var pwd1=$("#pwd1").val();
		var realName=$("#realName").val();
		var deleteFlag=$("#deleteFlag").val();
		var roleId=$("#roles").val();
		var userStatus=$("#userStatus").val();
		var mobile=$("#mobile").val();
		var job=$("#job").val();
		
		$.ajax({
			url:'modifySysUser',
			type:'post',
			dataType:'json',
			data:{userId:userId,loginName:loginName,pwd:pwd,pwd1:pwd1,
				realName:realName,deleteFlag:deleteFlag,roleId:roleId,
				userStatus:userStatus,mobile:mobile,job:job},
			success:function(data){
				alert(data.msg);
				if(data.status==0){
					window.location.href="sysUser.html";
				}
			},
			error:function(data){
				alert(errMsg);
			}
		})
	})
})
//跳转到修改管理员界面
function toModifySysUser(userId){
	window.location.href="modifySysUser.html?userId="+userId;
}